package com.atguigu.gulimail.member.web;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.fastjson.JSON;
import com.atguigu.common.utils.R;
import com.atguigu.gulimail.member.feign.OrderFeignSevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;

@Controller
public class MemberWebController {

    @Autowired
    OrderFeignSevice orderFeignSevice;

    @GetMapping("/memberOrder.html")
    public String memberOrderPage(@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum,
    Model model,
    HttpServletRequest request){


        HashMap<String, Object> page = new HashMap<>();
        page.put("page",pageNum.toString());
        // 查出当前登陆的用户的所有订单列表数据
        R r = orderFeignSevice.listWithItem(page);
        model.addAttribute("orders",r);
        return "orderList";
    }

}
